﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace 门诊管理系统
{
    public partial class gm : Form
    {
        public gm()
        {
            InitializeComponent();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void gm_Load(object sender, EventArgs e)
        {
            lab_xm.Text = txb.xm;
            lab_id.Text = txb.id;
            lab_idcard.Text = txb.idcard;
            SqlConnection sqlConnection = new SqlConnection();
            sqlConnection.ConnectionString =
                 ConfigurationManager.ConnectionStrings["connect"].ConnectionString;
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.Connection = sqlConnection;
            sqlCommand.CommandText = "SELECT * FROM tb_gm;";
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
            sqlDataAdapter.SelectCommand = sqlCommand;
            DataTable gmTable = new DataTable();
            sqlDataAdapter.Fill(gmTable);
            sqlConnection.Close();
            this.dgv_gm.Columns.Clear();
            this.dgv_gm.DataSource = gmTable;
            this.dgv_gm.Columns["guomingshi"].HeaderText = "过敏史";
            this.dgv_gm.Columns[this.dgv_gm.Columns.Count - 1].AutoSizeMode =
              DataGridViewAutoSizeColumnMode.Fill;
        }

 
    }
}
